<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:bands="http://projectsexception.com/festivales/bands">

  <xsl:template match="/">
    <bands:images>
      <xsl:apply-templates
        select="//bands:title[text()='image' and position()=1]" />
    </bands:images>
  </xsl:template>

  <xsl:template match="bands:title">
    <xsl:variable name="url">
      <xsl:choose>
        <xsl:when
          test="normalize-space(following-sibling::bands:value[position()=1]/text()) = ''">
          <xsl:text>http://localhost:8888/interface/res/images/icon.png</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of
            select="normalize-space(following-sibling::bands:value[position()=1]/text())" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <img src="{$url}" />
  </xsl:template>

  <xsl:template match="bands:title" priority="-1">
  </xsl:template>

</xsl:stylesheet>